<template>
  <view class="normal-login-container">

    <view class="item-wrap" style="margin-bottom: 0">
      <view class="lineBottom10">
        <uni-section title="外部转租赁供应商信息" type="line"/>
      </view>

      <view style="margin: 8rpx 20rpx 8rpx 20rpx">
        <uni-forms labelWidth="auto">
			  <uni-forms-item label="外部转租赁禀议编码:">
				<text class="auto-wrap">{{ isNoEmpty(ruleForm.carBasicVo.outNo)  }}</text>
			  </uni-forms-item>

			  <uni-forms-item label="供应商名称:">
				<text >{{isNoEmpty(ruleForm.carBasicVo.outSupplier)}}</text>
			  </uni-forms-item>

			  <uni-forms-item label="转租赁费用（含税）:">
				<text >{{ isNoEmpty(ruleForm.carBasicVo.outMoney)  }}</text>
			  </uni-forms-item>

			  <uni-forms-item label="采购类型:">
				<text >{{ isNoEmpty(ruleForm.carBasicVo.purchaseType)  }}</text>
			  </uni-forms-item>

			  <uni-forms-item label="新车/二手车:">
				  <text >{{ isNoEmpty(ruleForm.carBasicVo.carClassification)  }}</text>
				<!-- <text v-if="ruleForm.carBasicVo">{{ handleLabel(dict.type.quota_car_type, ruleForm.carBasicVo.carClassification) }}</text> -->
			  </uni-forms-item>
        </uni-forms>
      </view>
    </view>
  </view>
</template>

<script>
	import {externalublease} from "@/api/storage/in.js";
export default {
  name: 'externalLeasingInfo',//基础信息
  dicts: ['quota_car_type',],
  props: {
   value: {
     type: Object,
     default: {}
   }
  },
 computed: {
   ruleForm: {
     get() {
       let that = this
       const proxy = new Proxy(that.value, {
         get(target, key) {
           return Reflect.get(target, key)
         },
         set(target, key, value) {
           that.$emit('input', {...target, [key]: value})
           return true
         }
       })
       return proxy
     }
   },
   handleLabel() {
     return function (arr, type) {
       let name = ''
       arr.map((v) => {
         if (type == v.value) {
           name = v.label;
         }
       });
       return name
     }
   }
 },
	watch:{
		'ruleForm.carBasicVo':{
			deep:true,
			handler(val){
				this.ruleForm.carBasicVo = val
			},
			immediate:true
		}
	},
  data() {
    return {};
  },
  created() {
	  this.detailInfo()
  },
  mounted() {
  },
  methods: {
	   // 需要列表带过来的id
	  getExternalublease(id){
		  
		  externalublease(id).then((res)=>{
			  if(res.code==200){
				  this.$nextTick(()=>{
					this.ruleForm.carBasicVo.outNo = res.data?.outNo;
					this.ruleForm.carBasicVo.outId = res.data?.outId;
					this.ruleForm.carBasicVo.outSupplier = res.data?.outSupplier;
					this.ruleForm.carBasicVo.outMoney = res.data?.outMoney;
					this.ruleForm.carBasicVo.purchaseType = res.data?.purchaseType;
					this.ruleForm.carBasicVo.carClassification = res.data?.carClassification;
				  })
				 
				  console.log(this.ruleForm.carBasicVo,123)
			  }else{

			  }
			  
		  })
	  },
	  detailInfo(){
		  var _this = this;
		  if (this.ruleForm != null && this.ruleForm.carBasicVo != null) {
			  if(this.ruleForm.inboundId){
				  this.getExternalublease(this.ruleForm.inboundId);
			  }
		  
		  } else {
		  setTimeout(function () {
			  _this.detailInfo();
		  }, 100)
		  }
	  },
  },
};
</script>

<style lang="scss" scoped>
.car-wrap {
  display: flex;
  flex-direction: column;
  padding: 20rpx 20rpx 20rpx 0;
  border: 1px solid #dadada;
  margin: 10rpx 20rpx;
  border-radius: 8rpx;

}
.auto-wrap {
  white-space: pre-wrap; 
  word-break: break-all; 
  width: 200px; 
}


</style>


